<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Class CreatePeriodsTable.
 */
class CreatePeriodsTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('periods', function(Blueprint $table) {
            $table->increments('id');
            $table->smallInteger('year');
            $table->tinyInteger('month');
            $table->date('start_date');
            $table->date('end_date');
            $table->string('name')->unique();
            $table->tinyInteger('status')->default(0)->comment('0=>未执行计算,1=>已经执行计算,2=>审核');
            $table->unsignedInteger('verifier_id')->nullable();
            $table->dateTime('verify_date')->nullable();
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->useCurrent();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('periods');
	}
}
